<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="./../assets/css/combined.css">
	<script src="http://www.google.com/jsapi" type="text/javascript"></script>
	<script type="text/javascript">
		var path = './../';
		var class_prefix = "Asset::";
	</script>
	<script src="./../assets/js/combined.js"></script>
	<title>Asset - Classes - FuelPHP Documentation</title>
</head>
<body>
	<div id="container">
		<header id="header">
			<div class="table">
				<h1>
					<strong>FuelPHP, a PHP 5.3 Framework</strong>
					Documentation
				</h1>
				
				<form id="google_search">
					<p>
						<span id="search_clear">&nbsp;</span>
						<input type="submit" name="search_submit" id="search_submit" value="search" />
						<input type="text" value="" id="search_input" name="search_input" />						
					</p>
				</form>
			</div>
			<nav>
				
				<div class="clear"></div>
			</nav>
			<a href="#" id="toc_handle">table of contents</a>
			<div class="clear"></div>
		</header>
		
		<div id="cse">
			<div id="cse_point"></div>
			<div id="cse_content"></div>
		</div>
		
		<div id="main">
		
			<h2>Asset Class</h2>
	
			<p>The asset class is a set of methods to help with the collection, grouping and displaying of assets (js, css, img). Each asset is a RELATIVE path from the base_url WITH a trailing slash.</p>
	
			<article>
				<h4 id="method_add_path" class="method">add_path($path)</h4>
				<p>The <strong>add_path</strong> method adds the given path to the front of the assets path array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$path</kbd></th>
									<td><i>required</i></td>
									<td>The path to add to the front of the assets path array (RELATIVE to base url WITH trailing slash).</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>void</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>Asset::add_path('resources/template_1/');

Asset::add_path('resources/template_2/');

/* 
NOTE: The paths referenced above would need to have subfolders of js, css, and/or img
depending on the type of content you were trying to use.
*/</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			
			<article>
				<h4 id="method_css" class="method">css($stylesheets = array(), $attr = array(), $group = NULL, $raw = false)</h4>
				<p>The <strong>css</strong> method adds css to a group or returns the css tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$stylesheets</kbd></th>
									<td><i>required</i></td>
									<td>An array/string of stylesheet filename(s) to be added to the group or be returned as tags.</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><pre class="php"><code>array()</code></pre></td>
									<td>An array of attributes to be applied to the css file(s).</td>
								</tr>
								<tr>
									<th><kbd>$group</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>A group name to categorize the css. If left null the method will return the css tag.</td>
								</tr>
								<tr>
									<th><kbd>$raw</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If set to true the result css tags will include the file contents directly instead of via a link tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// adds file to group and returns '' if group is not null
Asset::css(array('header.css', 'footer.css'), array(), 'layout', false);

/* returns
&lt;link href="../assets/css/inline.css" rel="stylesheet" /&gt;
*/
echo Asset::css('inline.css');

/* returns 
&lt;style&gt;
.bold_class { font-weight: bold }
#header {height: 50px}
&lt;/style&gt;
*/
echo Asset::css('inline.css', array(), null, true);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			
			<article>
				<h4 id="method_find_file" class="method">find_file($file, $folder)</h4>
				<p>The <strong>find_file</strong> locates a file in all the asset paths.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$file</kbd></th>
									<td><i>required</i></td>
									<td>The name of the file you are searching for.</td>
								</tr>
								<tr>
									<th><kbd>$folder</kbd></th>
									<td><i>required</i></td>
									<td>The name of the folder which contains the file you are looking for (css, js, img).</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>Either the path to the file or false if not found</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$path = Asset::find_file('layout.css', 'css');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			
			<article>
				<h4 id="method_img" class="method">img($images = array(), $attr = array(), $group = NULL)</h4>
				<p>The <strong>img</strong> either adds the image to the group, or returns the image tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$images</kbd></th>
									<td><i>required</i></td>
									<td>An array/string of image filename(s) to be applied to the group or returned as tags.</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><pre class="php"><code>array()</code></pre></td>
									<td>An array of attributes to apply to the image tag(s).</td>
								</tr>
								<tr>
									<th><kbd>$group</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>The group to apply the images to.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// returns &lt;img src="../assets/img/logo.png" id="logo"&gt;
echo Asset::img('logo.png', array('id' => 'logo'));

Asset::img(array('bob.jpg', 'joe.jpg', 'sally.jpg'), array('class' => 'thumbnail'), 'team_avatars');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			
			<article>
				<h4 id="method_js" class="method">js($scripts = array(), $attr = array(), $group = NULL, $raw = false)</h4>
				<p>The <strong>js</strong> either adds the javascript to the group, or returns the script tag.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$scripts</kbd></th>
									<td><i>required</i></td>
									<td>An array/string of stylesheet filename(s) to be added to the group or be returned as tags.</td>
								</tr>
								<tr>
									<th><kbd>$attr</kbd></th>
									<td><pre class="php"><code>array()</code></pre></td>
									<td>An array of attributes to be applied to the js file(s).</td>
								</tr>
								<tr>
									<th><kbd>$group</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>A group name to categorize the js. If left null the method will return the js tag.</td>
								</tr>
								<tr>
									<th><kbd>$raw</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If set to true the result js tags will include the file contents directly instead of via a script src tag.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// returns '' if $raw is set to false
Asset::js(array('jquery.js', 'jqueryui.js'), array(), 'jquery', false);

/* returns
&lt;script type="text/javascript"&gt;
var menu = getElementById('menu');
menu.initialize_menu();
&lt;/script&gt;
*/
echo Asset::js('menu_init.js', array(), null, true);

// returns &lt;script type="text/javascript" src="../assets/js/jquery.js"&gt;&lt;/script&gt;
echo Asset::js('jquery.js');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
		
			<article>
				<h4 id="method_remove_path" class="method">remove_path($path)</h4>
				<p>The <strong>remove_path</strong> removes the given path from the asset paths array</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$path</kbd></th>
									<td><i>required</i></td>
									<td>The path to from the assets path array.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>void</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>Asset::remove_path('resources/template_1/');

Asset::remove_path('resources/template_2/');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			
			<article>
				<h4 id="method_render" class="method">render($group, $raw = false)</h4>
				<p>The <strong>render</strong> renders the group of assets and returns the tags.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$group</kbd></th>
									<td><i>required</i></td>
									<td>The name of the group to render.</td>
								</tr>
								<tr>
									<th><kbd>$raw</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If true this method will return an internal css/js tags.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>string</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>/* returns
&lt;link href="../assets/css/header.css" rel="stylesheet" /&gt;
&lt;link href="../assets/css/footer.css" rel="stylesheet" /&gt;
*/
echo Asset::render('layout');</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
		
		</div>

		<footer>
			<p>
				&copy; FuelPHP Development Team 2010-2011 - <a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.
			</p>
		</footer>
	</div>
</body>
</html>